
/**
 * @class Kohive.app.OverviewController
 * @extends ExtMVC.Controller
 * Manages the Overview model
 */
Kohive.app.OverviewController = Ext.extend(Kohive.controllers.KohiveController,
		{
			name		: 'overview',
			title		: Ext.ux.Translator.translate('app_overview'),

			constructor	: function() {
				Kohive.app.OverviewController.superclass.constructor.call(this,
						{
							viewsPackage	: Kohive.views.overview
						}
				);

				// TODO: This is a relic of old MVC, remove it once on ExtMVC 0.6 or above
				this.registerAction('index', this.index);
			},

			/**
			 * @action index 
			 * Renders the index view
			 */
			index		: function() {
				var store = Kohive.models.Overview.findAll({
							url			: Kohive.OS.scopedUrl('overview'),
							autoLoad	: false,
							listeners	: {
								'load'	: {
									scope	: this,
									fn		: function(store, records) {
										this.indexWindow.hideLoading();
									}
								}
							}
						});

				this.indexWindow = this.renderView('index', {
							store		: store,
							closeAction	: 'hide',
							autoShow	: true
						});

				this.indexWindow.show();

				this.fireEvent('index');
			}
		}
);

Kohive.OS.registerController('overview', Kohive.app.OverviewController);